﻿using GN.Data.Entity;
using System.Collections.Generic;

namespace GN.Data.ISqlClient
{
    public interface IExecute
    {
        /// <summary>
        /// 增加一条数据
        /// </summary>
        int AddToDB<T>(T model) where T : EntityModel;
        /// <summary>
        /// 更新一条数据
        /// </summary>
        bool UpdateToDB<T>(T model) where T : EntityModel;

        /// <summary>
        /// 删除一条数据
        /// </summary>
        bool DeleteFromDB<T>(int id);

        /// 根据条件删除数据
        /// </summary>
        bool DeleteByWhereFromDB<T>(string where, params IDataParameter[] paramter);

        /// <summary>
        /// 批量删除数据
        /// </summary>
        bool DeleteListFromDB<T>(string idlist);

        /// <summary>
        /// 带事务执行多条sql语句
        /// </summary>
        bool ExecuteAnysqlWithTran(List<string> sqls, List<IDataParameter[]> paramters);
    }
}
